import requests from "./request";
import mockRequests from './mockRequest '

export const reqCategory = () => {
    return requests({
        url: '/product/getBaseCategoryList',
        method: 'get'
    })
}

export const reqBanner = () => {
    return mockRequests({
        url: '/banner',
        method: 'get'
    })
}

export const reqFloor = () => {
    return mockRequests({
        url: '/floor',
        method: 'get'
    })
}

export const reqSearchInfo = (p) => {
    return requests({
        url: '/list',
        method: 'post',
        data: p
    })
}

export const reqGoodsInfo = (skuId) => {
    return requests({
        url: `/item/${skuId}`,
        method: 'get'
    })
}

export const reqCardInfo = (skuId, skuNum) => {
    return requests({
        url: `/cart/addToCart/${skuId}/${skuNum}`,
        method: 'post'
    })
}

export const reqCardList = () => {
    return requests({
        url: 'cart/cartList',
        method: 'get'
    })
}

export const reqDeleteGoods = (skuId) => {
    return requests({
        url: `/cart/deleteCart/${skuId}`,
        method: 'delete'
    })
}

export const reqGoodsCheck = (skuId, isChecked) => {
    return requests({
        url: `/cart/checkCart/${skuId}/${isChecked}`,
        method: 'get'
    })
}

export const reqPhoneCode = (phone) => {
    return requests({
        url: `/user/passport/sendCode/${phone}`,
        method: 'get'
    })
}

export const reqUserRegister = (myData) => {
    return requests({
        url: '/user/passport/register',
        method: 'post',
        data: myData
    })
}

export const reqUserLogin = (myData) => {
    return requests({
        url: '/user/passport/login',
        method: 'post',
        data: myData
    })
}

export const reqLoginInfo = () => {
    return requests({
        url: '/user/passport/auth/getUserInfo',
        method: 'get',
    })
}

export const reqLogout = () => {
    return requests({
        url: '/user/passport/logout',
        method: 'get',
    })
}

export const reqAddress = () => {
    return requests({
        url: '/user/userAddress/auth/findUserAddressList',
        method: 'get',
    })
}

export const reqOrderInfo = () => {
    return requests({
        url: '/order/auth/trade',
        method: 'get',
    })
}

export const reqSubmitOrder = (tradeNo, myData) => {
    return requests({
        url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
        method: 'post',
        data: myData
    })
}

export const reqOrderPay = (orderId) => {
    return requests({
        url: `/payment/weixin/createNative/${orderId}`,
        method: 'get',
    })
}

export const reqMyCard = (page, limit) => {
    return requests({
        url: `/order/auth/${page}/${limit}`,
        method: 'get',
    })
}